Constants

SEARCH_ADDRESSBOOK

SEARCH_ADDRESSBOOK = 1

SEARCH_MAIL

SEARCH_MAIL = 2

Properties

$ID

$ID : int

Type

int — User identifier

$data

$data : array

Type

array — User properties

$language

$language : string

Type

string — User language code

$prefs

$prefs : array

Type

array — User preferences

$db

$db : \rcube_db

Type

rcube_db — Holds database connection

$rc

$rc : \rcube

Type

rcube — Framework object

$identities

$identities : array

Type

array — Internal identities cache

$emails

$emails : array

Type

array — Internal emails cache

Methods

__construct()

__construct(int  $id = null, array  $sql_arr = null) : mixed

Object constructor

Parameters

int $id

User id

array $sql_arr

SQL result set

Returns

mixed —

get_username()

get_username(string  $part = null) : string

Build a user name string (as e-mail address)

Parameters

string $part

Username part (empty or 'local' or 'domain', 'mail')

Returns

string —

Full user name or its part

get_prefs()

get_prefs() : array

Get the preferences saved for this user

Returns

array —

Hash array with prefs

save_prefs()

save_prefs(array  $a_user_prefs, bool  $no_session = false) : bool

Write the given user prefs to the user's record

Parameters

array $a_user_prefs

User prefs to save

bool $no_session

Simplified language/preferences handling

Returns

bool —

True on success, False on failure

get_hash()

get_hash() : mixed

Generate a unique hash to identify this user with

Returns

mixed —

list_emails()

list_emails(bool  $default = false) : array

Return a list of all user emails (from identities)

Parameters

bool $default

Return only default identity

Returns

array —

List of emails (identity_id, name, email) or single email-data

get_identity()

get_identity(int  $id = null) : array

Get default identity of this user

Parameters

int $id

Identity ID. If empty, the default identity is returned

Returns

array —

Hash array with all cols of the identity record

list_identities()

list_identities(string  $sql_add = '', bool  $formatted = false) : array

Return a list of all identities linked with this user

Parameters

string $sql_add

Optional WHERE clauses

bool $formatted

Format identity email and name

Returns

array —

List of identities

update_identity()

update_identity(int  $iid, array  $data) : bool

Update a specific identity record

Parameters

int $iid

Identity ID

array $data

Hash array with col->value pairs to save

Returns

bool —

True if saved successfully, false if nothing changed

insert_identity()

insert_identity(array  $data) : int|false

Create a new identity record linked with this user

Parameters

array $data

Hash array with col->value pairs to save

Returns

int|false —

The inserted identity ID or false on error

delete_identity()

delete_identity(int  $iid) : bool

Mark the given identity as deleted

Parameters

int $iid

Identity ID

Returns

bool —

True if deleted successfully, false if nothing changed

set_default()

set_default(int  $iid) : mixed

Make this identity the default one for this user

Parameters

int $iid

The identity ID

Returns

mixed —

touch()

touch() : mixed

Update user's last_login timestamp

Returns

mixed —

failed_login()

failed_login() : mixed

Update user's failed_login timestamp and counter

Returns

mixed —

is_locked()

is_locked() : mixed

Checks if the account is locked, e.g. as a result of brute-force prevention

Returns

mixed —

reset()

reset() : mixed

Clear the saved object state

Returns

mixed —

query()

query(string  $user, string  $host) : \rcube_user

Find a user record matching the given name and host

Parameters

string $user

IMAP user name

string $host

IMAP host name

Returns

\rcube_user —

New user instance

create()

create(string  $user, string  $host) : \rcube_user|null

Create a new user record and return a rcube_user instance

Parameters

string $user

IMAP user name

string $host

IMAP host

Returns

\rcube_user|null —

New user instance on success, Null on error/abort

email2user()

email2user(string  $email) : string

Resolve username using a virtuser plugins

Parameters

string $email

E-mail address to resolve

Returns

string —

Resolved IMAP username

user2email()

user2email(string  $user, bool  $first = true, bool  $extended = false) : mixed

Resolve e-mail address from virtuser plugins

Parameters

string $user

User name

bool $first

If true returns first found entry

bool $extended

If true returns email as array (email and name for identity)

Returns

mixed —

Resolved e-mail address string or array of strings

list_searches()

list_searches(int  $type) : array

Return a list of saved searches linked with this user

Parameters

int $type

Search type

Returns

array —

List of saved searches indexed by search ID

get_search()

get_search(int  $id) : array

Return saved search data.

Parameters

int $id

Row identifier

Returns

array —

Data

delete_search()

delete_search(int  $sid) : bool

Deletes given saved search record

Parameters

int $sid

Search ID

Returns

bool —

True if deleted successfully, false if nothing changed

insert_search()

insert_search(array  $data) : int

Create a new saved search record linked with this user

Parameters

array $data

Hash array with col->value pairs to save

Returns

int —

The inserted search ID or false on error